Don't create the GdkPixbuf until we know that we have something to put in
authorTor Lillqvist <tml@novell.com>
Wed, 6 Jul 2005 15:30:10 +0000 (15:30 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Wed, 6 Jul 2005 15:30:10 +0000 (15:30 +0000)
2005-07-06  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkcursor-win32.c
(gdk_win32_icon_to_pixbuf_libgtk_only): Don't create the GdkPixbuf
until we know that we have something to put in it.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gdk/win32/gdkcursor-win32.c

index 0bd5eb5435d2e95314bcae5d3befc254053db91a..335045915d4f850432f5d19d485d14722a98069c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-07-06  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkcursor-win32.c
+       (gdk_win32_icon_to_pixbuf_libgtk_only): Don't create the GdkPixbuf
+       until we know that we have something to put in it.
+
 2005-07-05  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkspinbutton.c (gtk_spin_button_new_with_range): Add some
index 0bd5eb5435d2e95314bcae5d3befc254053db91a..335045915d4f850432f5d19d485d14722a98069c 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-06  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkcursor-win32.c
+       (gdk_win32_icon_to_pixbuf_libgtk_only): Don't create the GdkPixbuf
+       until we know that we have something to put in it.
+
 2005-07-05  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkspinbutton.c (gtk_spin_button_new_with_range): Add some
index 0bd5eb5435d2e95314bcae5d3befc254053db91a..335045915d4f850432f5d19d485d14722a98069c 100644 (file)
@@ -1,3 +1,9 @@
+2005-07-06  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkcursor-win32.c
+       (gdk_win32_icon_to_pixbuf_libgtk_only): Don't create the GdkPixbuf
+       until we know that we have something to put in it.
+
 2005-07-05  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkspinbutton.c (gtk_spin_button_new_with_range): Add some
index d2dd6de8ca611351caa18b6c702c8b34050dd0d3..54af4a82cefd2665d979fb3c474694714990ed2e 100644 (file)
@@ -426,14 +426,15 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
   if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
     return NULL;
 
-  memset (&bmi, 0, sizeof (bmi));
-  bmi.bi.biSize = sizeof (bmi.bi);
   if (!(hdc = CreateCompatibleDC (NULL)))
     {
       WIN32_GDI_FAILED ("CreateCompatibleDC");
       goto out0;
     }
 
+  memset (&bmi, 0, sizeof (bmi));
+  bmi.bi.biSize = sizeof (bmi.bi);
+
   if (!GDI_CALL (GetDIBits, (hdc, ii.hbmColor, 0, 1, NULL, (BITMAPINFO *)&bmi, DIB_RGB_COLORS)))
     goto out1;
 
@@ -443,13 +444,14 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
   bmi.bi.biBitCount = 32;
   bmi.bi.biCompression = BI_RGB;
   bmi.bi.biHeight = -h;
-  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
+
   bits = g_malloc0 (4 * w * h);
       
   /* color data */
   if (!GDI_CALL (GetDIBits, (hdc, ii.hbmColor, 0, h, bits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS)))
     goto out2;
   
+  pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
   pixels = gdk_pixbuf_get_pixels (pixbuf);
   rowstride = gdk_pixbuf_get_rowstride (pixbuf);
   no_alpha = TRUE;